home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / yerk / mps231ss.hqx / Mops source / Nuc source / OD.asm < prev    next >
Assembly Source File  |  1992-10-08  |  5KB  |  191 lines

  1. ; Operation descriptor definition.  An OD keeps track of optimization 
  2. ; possibilities.  We usually address ODs via A0, so we make this the default.
  3.  
  4.     base    A0
  5.     dsec    0
  6.  
  7. opType    byte        ; main type
  8. opSubType    byte        ; subtype
  9. opSize    equ    *-1    ; for fetches/stores, size code
  10. opToFrom    byte        ; for fetches/stores, source or dest reg 
  11. opMode    byte        ; Address mode - see definition below
  12. opBreg    byte        ; base reg (normally A3)
  13. opReg    equ    *-1    ; reg for reg direct mode
  14.             ;  (really same as base reg)
  15. opXreg    byte        ; Index register
  16. opShort    equ    *-1    ; Flags a short literal or short imm address
  17. opRoffs    equ    *-1    ; FPU constant ROM offset
  18. opShiftCnt    equ    *-1    ; Shift count (for shifts, of course)
  19. opFlags    byte        ; Sundry other flags
  20. opInd    byte        ; Indirection count (0 = immediate, etc.)
  21. opLit    long        ; literal value (if appropriate)
  22. opDispl    equ    *-4    ; displacement
  23. opFPDP    equ    *-4    ; saves DP in floating op before store back
  24. opAddr    long        ; saves the data address (if a mem reference)
  25. opDP    long        ; Saves DP value - this must come last
  26.  
  27.     dend    ODsize
  28.     endb
  29.  
  30. ; opMode values:
  31.  
  32. mdBD    equ    0    ; An-displacement
  33. mdX    equ    1    ; Indexed
  34. mdAbs    equ    2    ; absolute
  35. mdLit    equ    3    ; literal
  36. mdDn    equ    4    ; Dn direct
  37. mdAn    equ    5    ; An direct
  38. mdPC    equ    6    ; PC-relative
  39. mdPCX    equ    7    ; PC-relative with index
  40. mdFPn    equ    8    ; FPn
  41.  
  42. ; Codes for opMode or opToFrom.  Note the stack codes are all negative.
  43.  
  44. stkPush    equ    $FF    ; With stack push
  45. stk    equ    $FE    ; To/from stack without push or pop
  46. stkPop    equ    $FD    ; With stack pop
  47. fromMem    equ    $E0    ; In a store descriptor, marks a chained op 
  48.             ;  with a preceding fetch.
  49. fchChn    equ    $70    ; In an arithmetic descriptor, marks a chained 
  50.             ;  op with a preceding fetch.
  51.  
  52. ; opReg flags:
  53.  
  54. AnReg    equ    $40
  55. FPnReg    equ    $20
  56. noReg    equ    $48
  57.  
  58. ; Flag byte bits:
  59.  
  60. flExt    equ    0    ; Sign extend
  61. fbExt    equ    $01
  62.  
  63. flFP    equ    1    ; Floating operation
  64. fbFP    equ    $02
  65.  
  66. flLit    equ    2    ; Floating Literal
  67. fbLit    equ    $04
  68.  
  69. flFCR    equ    3    ; FPU constant ROM reference
  70. fbFCR    equ    $08
  71.  
  72. ; Codes for ODs:
  73.  
  74. ; Type byte
  75.  
  76. ; otMove    equ    $10
  77.  
  78. otMulDiv    equ    $12
  79. otMUL    equ    $12
  80. otDIV    equ    $13
  81.  
  82. otPMops    equ    $21    ; Codes for integer arith/logical ops.
  83.  
  84. otADD    equ    $21
  85. otSUB    equ    $22
  86. otAND    equ    $23
  87. otOR    equ    $24
  88. otEOR    equ    $25
  89. otCMP    equ    $26
  90.  
  91. otMon    equ    $28    ; The following ops are monadic
  92. otNEG    equ    $28
  93. otNOT    equ    $29
  94. otSHIFT    equ    $2A    ; shift by a constant
  95.  
  96. otRevSub     equ    $2E    ; Reverse subtract
  97. otPMend    equ    $30    ; End of integer ops
  98.  
  99. otFPcmp    equ    $3F    ; Floating-point comparison.  A special case.
  100. otFPops    equ    $40    ; Start of regular floating-point ops.  Note 
  101.             ;  these are NOT in the same order as the 
  102.             ;  integer ops.
  103. otFMOVE    equ    $40
  104. otFADD    equ    $41
  105. otFMUL    equ    $42
  106.  
  107. otFPnoncom    equ    $48    ; The following FP ops are non-commutative
  108.  
  109. otFSUB    equ    $48
  110. otFDIV    equ    $49
  111.  
  112. otFPmon    equ    $54    ; The following FP ops are monadic
  113. otFABS    equ    $54
  114. otFNEG    equ    $55
  115. otFSIN    equ    $56
  116. otFCOS    equ    $57
  117. otFTAN    equ    $58
  118. otFATAN    equ    $59
  119. otFSQRT    equ    $5A
  120.  
  121. otFPend    equ    $60    ; End of FP ops
  122.  
  123. otStore    equ    $60    ; Store
  124. otFetch    equ    $61    ; Direct fetch
  125. otAt    equ    otFetch    ; Indirect fetch - ends up being treated
  126.             ;  the same
  127. otDUP    equ    $62    ; DUP etc.
  128. otOVER    equ    $63    ; OVER
  129. otSWAP    equ    $64    ; SWAP
  130.  
  131. otCCok    equ    $70    ; Used to mark CC as valid for top-of-stack
  132.             ;  operand if nothing else.  All codes for 
  133.             ;  which otStore < code <= otCCok,
  134.             ;  indicate that the CC is valid.
  135.  
  136. otJSR    equ    $71    ; Plain vanilla JSR
  137. otBit    equ    $72    ; Bit operations
  138. otOp2M    equ    $73    ; Operation to memory -  ++> etc.
  139.  
  140. ; Comparisons (type and subtype together - type is always otCMP)
  141. ; The subtype codes are based on the corresponding 68000 codes, which are
  142. ; very logical.  For example, the inverse condition is obtained by
  143. ; inverting the low bit.
  144.  
  145. tsEQ    equ    otCMP*256 + $7
  146. tsNE    equ    otCMP*256 + $6
  147. tsGE    equ    otCMP*256 + $C
  148. tsLT    equ    otCMP*256 + $D
  149. tsLE    equ    otCMP*256 + $F
  150. tsGT    equ    otCMP*256 + $E
  151. tsLO    equ    otCMP*256 + $5
  152. tsLS    equ    otCMP*256 + $3
  153. tsHI    equ    otCMP*256 + $2
  154. tsHS    equ    otCMP*256 + $4
  155.  
  156. tsZEQ    equ    otCMP*256 + $17
  157. tsZNE    equ    otCMP*256 + $16
  158. tsZGE    equ    otCMP*256 + $1C
  159. tsZLT    equ    otCMP*256 + $1D
  160. tsZLE    equ    otCMP*256 + $1F
  161. tsZGT    equ    otCMP*256 + $1E
  162.  
  163. tsDUP    equ    otDup*256 + 0
  164. ;tsQDUP    equ    otDup*256 + 1
  165. ;tsZDUP    equ    otDup*256 + 2
  166.  
  167. ; Bit operations.  The subtype code is the same as the type code
  168. ; in the corresponding 68000 instruction.
  169.  
  170. tsBtest    equ    otBit*256 + 0
  171. tsBtoggle    equ    otBit*256 + 1
  172. tsBreset    equ    otBit*256 + 2
  173. tsBset    equ    otBit*256 + 3
  174.  
  175. ; Length codes (in subtype byte) - used for fetch and @
  176.  
  177. Lcode    equ    2
  178. Wcode    equ    1
  179. Ccode    equ    0
  180.  
  181. tsAt    equ    otAt*256 + Lcode
  182. tsWat    equ    otAt*256 + Wcode
  183. tsCat    equ    otAt*256 + Ccode
  184.  
  185. tsSt    equ    otStore*256 + Lcode
  186. tsWst    equ    otStore*256 + Wcode
  187. tsCst    equ    otStore*256 + Ccode
  188.  
  189. tsFetch    equ    otFetch * 256
  190. tsCCok    equ    otCCok * 256
  191.